package com.nlx.notes.module.controller.statistics;

import com.nlx.notes.module.bean.dto.querydb.StatisticsQueryDTO;
import com.nlx.notes.module.bean.dto.statistics.TopStatisticsDTO;
import com.nlx.notes.module.bean.vo.statistics.MonthStatisticsVO;
import com.nlx.notes.module.bean.vo.statistics.TopStatisticsVO;
import com.nlx.notes.module.core.util.JSONUtils;
import com.nlx.notes.module.service.statistics.StatisticsManageService;
import com.nlx.notes.support.context.UserHolder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/moth-statistics")
@RequiredArgsConstructor
public class MonthStatisticsManageController {

    final StatisticsManageService statisticsManageService;

    /**
     * 月度收入统计
     */
    @GetMapping(value = "/v1/overview")
    public MonthStatisticsVO monthOverview(StatisticsQueryDTO statisticsQueryDTO){
        statisticsQueryDTO.setUserId(UserHolder.getUserContext().getId());
        statisticsQueryDTO.setBookId(UserHolder.getUserContext().getBookId());
        log.info("查询月度概览，参数：{}", JSONUtils.toString(statisticsQueryDTO));
        return statisticsManageService.monthOverview(statisticsQueryDTO);
    }





}
